<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>ActlKeyMacro</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../styles/styles.css">
<script language="javascript" src='../links.js' type="text/javascript"></script>
</head>
<body>

<h1>ActlKeyMacro</h1>
<div class=navbar>
<a href="../index.html">main</a> |
<a  href="index.html">structures</a><br>
</div>

<div class=shortdescr>
The <dfn>ActlKeyMacro</dfn> structure is used in
the <a href="../service_functions/advcontrol.html">AdvControl</a> function
for operations with macro-commands.
</div>

<pre class=syntax>
struct ActlKeyMacro {
  int Command;
  union{
    struct {
      char *SequenceText;
      DWORD Flags;
    } PlainText;
    DWORD Reserved[3];
  } Param;
};
</pre>
<h3>Elements</h3>
<div class=descr>

    <div class=dfn>Command</div>
    <div class=dfndescr>One of the following commands (<a name="FARMACROCOMMAND">FARMACROCOMMAND</a> enum):
<table class="cont">
<tr class="cont"><th class="cont" width="40%">Command</th><th class="cont" width="60%">Description</th></tr>

<tr class="cont"><td class="cont" width="40%"><a name="MCMD_LOADALL">MCMD_LOADALL</a></td>
<td class="cont" width="60%">Read all macros from the registry into FAR memory. Previous values are erased.
</td></tr>

<tr class="cont"><td class="cont" width="40%"><a name="MCMD_POSTMACROSTRING">MCMD_POSTMACROSTRING</a></td>
<td class="cont" width="60%">Pass a macro in text form to FAR (in the same format as macros are stored in the registry).<br>
The <a href="../service_functions/advcontrol.html">AdvControl</a> function returns TRUE if the macro is analyzed and placed
into the queue (the macro will start running when FAR gets control). FALSE is returned if the macro contains any error.
</td></tr>

<tr class="cont"><td class="cont" width="40%"><a name="MCMD_SAVEALL">MCMD_SAVEALL</a></td>
<td class="cont" width="60%">Forces FAR to immediately save all macros from memory to the registry.</td></tr>

<tr class="cont"><td class="cont" width="40%"><a name="MCMD_GETSTATE">MCMD_GETSTATE</a></td>
<td class="cont" width="60%">Get macro execution status.<br>Returns one of the following values (enum <a name="FARMACROSTATE">FARMACROSTATE</a>):
  <table class="cont">
    <tr class="cont"><th class="cont" width="40%">Value</th><th class="cont" width="60%">Description</th></tr>
    <tr class="cont"><td class="cont" width="40%"><a name="MACROSTATE_NOMACRO">MACROSTATE_NOMACRO</a></td>
    <td class="cont" width="60%">no macro is being executed</td></tr>
    <tr class="cont"><td class="cont" width="40%"><a name="MACROSTATE_EXECUTING">MACROSTATE_EXECUTING</a></td>
    <td class="cont" width="60%">a macro is being executed without sending key strokes to plugins</td></tr>
    <tr class="cont"><td class="cont" width="40%"><a name="MACROSTATE_EXECUTING_COMMON">MACROSTATE_EXECUTING_COMMON</a></td>
    <td class="cont" width="60%">a macro is being executed; key strokes are sent to plugins</td></tr>
    <tr class="cont"><td class="cont" width="40%"><a name="MACROSTATE_RECORDING">MACROSTATE_RECORDING</a></td>
    <td class="cont" width="60%">a macro is being recorded without sending key strokes to plugins</td></tr>
    <tr class="cont"><td class="cont" width="40%"><a name="MACROSTATE_RECORDING_COMMON">MACROSTATE_RECORDING_COMMON</a></td>
    <td class="cont" width="60%">a macro is being recorded; key strokes are sent to plugins</td></tr>
  </table>
  <em>Param</em> is ignored. The value is returned by <a href="../service_functions/advcontrol.html">AdvControl</a>.

</td></tr>

</table>
    </div>
    <div class=dfn>Param.PlainText.SequenceText</div>
    <div class=dfndescr>Pointer to a zero-terminated string containing a macro sequence in text form.
     OEM-encoding should be used to store macros.
     This member is used in the <dfn>MCMD_POSTMACROSTRING</dfn> command.
    </div>

    <div class=dfn>Param.PlainText.Flags</div>
    <div class=dfndescr>Combination of the following macro execution flags (<a name="FARKEYSEQUENCEFLAGS">FARKEYSEQUENCEFLAGS</a> enum):
<table class="cont">
<tr class="cont"><th class="cont" width="40%">Flag</th><th class="cont" width="60%">Description</th></tr>
       <tr class="cont"><td class="cont" width="40%"><a name="KSFLAGS_DISABLEOUTPUT">KSFLAGS_DISABLEOUTPUT</a></td>
       <td class="cont" width="60%">Disable screen output during macro playback.</td></tr>
       <tr class="cont"><td class="cont" width="40%"><a name="KSFLAGS_NOSENDKEYSTOPLUGINS">KSFLAGS_NOSENDKEYSTOPLUGINS</a></td>
       <td class="cont" width="60%">Don't send keystrokes to editor plugins (plugins, that export
        <a href="../exported_functions/processeditorinput.html">ProcessEditorInput</a> function).</td></tr>
       <tr class="cont"><td class="cont" width="40%"><a name="KSFLAGS_REG_MULTI_SZ">KSFLAGS_REG_MULTI_SZ</a></td>
       <td class="cont" width="60%">The <em>Param.PlainText.SequenceText</em> parameter is represented in the <dfn>REG_MULTI_SZ</dfn> format.<br>
         REG_MULTI_SZ in the registry:
<pre class=code>line 1\x00
line 2\x00
...
line N\x00
\x00</pre>

       </td>
</table>
     This member is used in the <dfn>MCMD_POSTMACROSTRING</dfn> command.
    </div>

    <div class=dfn>Reserved</div>
    <div class=dfndescr>Reserved for future use.</div>

</div>

<h3>Remarks</h3>
<div class=descr>
<ol>
<li>The <dfn>MCMD_LOADALL</dfn> and <dfn>MCMD_SAVEALL</dfn> commands won't execute  during macro recording or playback.</li>
<li>The <dfn>KSFLAGS_REG_MULTI_SZ</dfn> flag can be discarded, if <em>Param.PlainText.SequenceText</em> contains '\n' instead of 0x00.
</ol>
</div>

<h3>Example</h3>
<div class=descr>
<dfn>MCMD_POSTMACROSTRING</dfn> usage in FARCmds plugin:
<pre class=code>command.Command=MCMD_POSTMACROSTRING;
command.Param.PlainText.SequenceText=(char *)malloc(strlen(pCmd)+1);
if(command.Param.PlainText.SequenceText)
{
  command.Param.PlainText.Flags=KSFLAGS_DISABLEOUTPUT;
  strcpy(command.Param.PlainText.SequenceText,pCmd);
  Info.AdvControl(Info.ModuleNumber,ACTL_KEYMACRO,&amp;command);
  free(command.Param.PlainText.SequenceText);
}
</pre>
<dfn>MCMD_LOADALL</dfn> usage in FARCmds plugin:
<pre class=code>command.Command=MCMD_LOADALL;
Info.AdvControl(Info.ModuleNumber,ACTL_KEYMACRO,&command);
</pre>
<dfn>MCMD_SAVEALL</dfn> usage in FARCmds plugin:
<pre class=code>command.Command=MCMD_SAVEALL;
Info.AdvControl(Info.ModuleNumber,ACTL_KEYMACRO,&command);
</pre>

</div>

<div class=see>See also:</div><div class=seecont>
<a href="index.html">Structures</a> |
<a href="keysequence.html">KeySequence</a> |
<a href="../delphi/tactlkeymacro.html">TActlKeyMacro</a>
</div>

</body>
</html>
